/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;
import java.util.ArrayList;
import DTO.LOAINHANVIENDTO;
import SQL.DataProvider;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
 *
 * @author NGUYEN
 */
public class LOAINHANVIENDAO {
    @SuppressWarnings("empty-statement")
    public ArrayList<LOAINHANVIENDTO> list_loainhanvien()
    {
        DataProvider pro = new DataProvider();
        ArrayList<LOAINHANVIENDTO> ds = new ArrayList<LOAINHANVIENDTO>();
        ResultSet rs=null;
        try
        {
            pro.open();
            String query = "SELECT * FROM LOAINHANVIEN";
            rs = pro.excutequery(query);
            while(rs.next())
            {
                LOAINHANVIENDTO dto = new LOAINHANVIENDTO();
                dto.setMaloainv(Integer.parseInt(rs.getString("MaLoaiNV")));
                dto.setTenloainv(rs.getString("TenLoaiNV"));
                ds.add(dto);
            }
        }
        catch(SQLException | NumberFormatException e)
        {
            e.printStackTrace();
        }
        finally
        {
            pro.close();
        }
        return ds;
    }
}
